package util;

import java.io.*;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdom.*;
import org.jdom.output.*;


public class GenerateXML {
    
    private static void generateClasses() throws IOException{
        Element pubElement = new Element("class");
        Document myDocument = new Document(pubElement);
        ArrayList <String> nomes = new ArrayList <String> ();
        ArrayList <String> regimes = new ArrayList <String> ();
        ArrayList <String> ects = new ArrayList <String> ();
        ArrayList <String> codigos = new ArrayList <String> ();
        ArrayList <String> tipos = new ArrayList <String> ();
        ArrayList <String> horarios = new ArrayList <String> ();
        ArrayList <String> horarios_dia = new ArrayList <String> ();
        
        nomes.add("not connected. Distances can be short, as a few meters as in television remote control; or long ranging from thousands to millions of kilometers for deep-space radio communications. It encompasses various types of fixed, mobile, and portable two-way radios, cellular telephones, personal digital assistants (PDAs), and wireless networking. Other examples of wireless technology include GPS units, Garage door openers or garage doors, wireless computer mice, keyboards and Headset (telephone/computer), headphones, radio receivers, satellite television, broadcast television and cordless telephones. ");//nomes.add("RS");nomes.add("IA");nomes.add("CG");nomes.add("MA");
//        regimes.add("1º Semestre");regimes.add("1º Semestre");regimes.add("1º Semestre");regimes.add("1º Semestre");regimes.add("1º Semestre");
//        ects.add("6");ects.add("6");ects.add("6");ects.add("6");ects.add("6");
//        codigos.add("123243");codigos.add("3233434");codigos.add("34333424");codigos.add("3434134241");codigos.add("34343134241");
//        tipos.add("Avulsa");tipos.add("Avulsa");tipos.add("Avulsa");tipos.add("Obrigatoria");tipos.add("Obrigatoria");
//        horarios.add("08-11h");horarios.add("09-12h");horarios.add("14-16h");horarios.add("16-17h");horarios.add("16-17h");
//        horarios_dia.add("2f");horarios_dia.add("3f");horarios_dia.add("4f");horarios_dia.add("5f");horarios_dia.add("6f");
         
        myDocument.addContent(0,new Comment("Generated automatically. Don't change it."));
        
        for (int i=0;i<nomes.size();i++){
            Element student = new Element("classes");
            Element nome = new Element("nome");
   //         Element regime = new Element("regime");
    //        Element ect = new Element("ects");
     //       Element codigo = new Element("codigo");
      //      Element tipo = new Element("tipo");
      //      Element horario = new Element("horario");
       //     Element horario_dia = new Element("horario_dia");
            
            nome.addContent(nomes.get(i));
//            regime.addContent(regimes.get(i));
//            ect.addContent(ects.get(i));
//            codigo.addContent(codigos.get(i));
//            tipo.addContent(tipos.get(i));
//            horario.addContent(horarios.get(i));
//            horario_dia.addContent(horarios_dia.get(i));
            
            student.addContent(nome);
//            student.addContent(regime);
//            student.addContent(ect);
//            student.addContent(codigo);
//            student.addContent(tipo);
//            student.addContent(horario);
//            student.addContent(horario_dia);
            
            pubElement.addContent(student);
        
        }
        
        
        // Write it to disk
        XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
        FileWriter writer = new FileWriter("material_MRC.xml");
        outputter.output(myDocument, writer);
        writer.close();       
        
    }
    
    public static void main(String[] args) {
        
        try {
            // Create a simple XML document
            generateClasses();
        } catch (IOException ex) {
            Logger.getLogger(GenerateXML.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}